package ch09_异常与处理;

enum LoginStatus{
	EMPTY_USERNAME,EMPTY_PASSWORD,INVALID_USER,FORBIDDEN_USER,SUCCESS
}
public class LoginService1 {
	public LoginStatus login(String username,String password) {
		if(username==null||username.trim().length()<1) {
			return LoginStatus.EMPTY_USERNAME;
		}
		if(password ==null||password.trim().length()<1) {
			return LoginStatus.EMPTY_PASSWORD;
		}
		if(username.trim().equals("admin")&&password.equals("admin")) {
			boolean b =System.currentTimeMillis() %2==0;
			return b ? LoginStatus.FORBIDDEN_USER:LoginStatus.SUCCESS;
		}else {
			return LoginStatus.INVALID_USER;
		}
	}
}
